package gogogo.liwushuo.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

import gogogo.liwushuo.R;
import gogogo.liwushuo.bean.ScollerBean;

/**
 * Created by chenjun on 2016/7/23.
 */
public class GridViewAdapter extends BaseAdapter {
    private List<ScollerBean.DataBean.ChannelsBean> channels;
    private Context mContext;

    public GridViewAdapter(List<ScollerBean.DataBean.ChannelsBean> channels,Context context){
        this.channels = channels;
        this.mContext = context;
    }
    @Override
    public int getCount() {
        return channels == null ? 0 : channels.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = LayoutInflater.from(mContext).inflate(R.layout.item_gridview, parent, false);
        TextView tv = (TextView) view.findViewById(R.id.tv_gridview);
        tv.setText(channels.get(position).getName());
        tv.setPadding(8,8,8,8);
        tv.setTextSize(15);
        return view;
    }
}
